<?php
/**************************************************************************
	ESAM (EVE to SMF API Module)
	Copyright (C) 2009  Clinton Weiss

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/

include_once("EsamQuery.php");
include_once("EsamMembers.php");

class EsamGlobal
{
	function getGlobalSetting($name, $default)
	{
		$esamMember = new EsamMembers();
		return $esamMember->getMemberSetting(-99, $name, $default);
	}

	function setGlobalSetting($name, $value)
	{
		$esamMember = new EsamMembers();
		$esamMember->setMemberSetting(-99, $name, $value);
	}

	function removeGlobalSetting($name)
	{
		$esamMember = new EsamMembers();
		$esamMember->removeMemberSetting(-99, $name);
	}

	// Support functions
	function getUserGroups()
	{
		$esamQuery = new EsamQuery();
		$esamQuery->setQuery($esamQuery->Q_MGROUP_LIST);
		return $esamQuery->getResultSet();
	}
	
	function getGroupName($id_group)
	{
		$esamQuery = new EsamQuery();
		$esamQuery->setQuery($esamQuery->Q_MGROUP_INFO);
		$esamQuery->setParameter("id_group", $id_group);
		return $esamQuery->getResultSetValue("groupName");
	}
}
?>
